<template>
  <div class="list">
    <group>
      <cell-box class="list_cell" is-link v-for="game in games" :key="game.id" @click.native="jump(game.id, game.title)">{{game.title}}</cell-box>
    </group>
  </div>
</template>

<script>
import { Group, CellBox } from "vux";

export default {
  data() {
    return {
      games: [],
      canEdit: false
    };
  },
  components: {
    Group,
    CellBox
  },
  created() {
    if (this.$route.query.mode == "edit") {
      this.canEdit = true;
    }
    let gameType = this.$route.query.type;
    this.apiService.club.gametypelist({ type: gameType }).then(res => {
      this.games = res.data.gametypelist;
    });
  },
  methods: {
    jump(id, title) {
      let querys = {
        gamename: title,
        gameId: id
      };
      if (this.canEdit) {
        querys.create = "yes";
        querys.mode = "edit";
      }
      this.$router.push({
        path: "gameRule",
        query: querys
      });
    }
  }
};
</script>

<style scoped>
.list::before {
  content: "";
  display: table;
}
.list .weui-cell {
  font-size: 0.3rem;
}
</style>


